{include file="public/header" /}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <fieldset id="searchFieldset_currentTableRenderId" class="table-search-fieldset">
                        <legend>条件搜索</legend>
                        <form class="layui-form layui-form-pane form-search">
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">付款开始日期</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="starttime" placeholder="下单时间" id="starttime"
                                        value="{:input('get.starttime')}" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">付款截止时间</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="endtime" placeholder="截止时间" id="endtime"
                                        value="{:input('get.endtime')}" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">组别</label>
                                <div class="layui-input-inline">
                                    <select name="cangku">
                                        <option value="">组别</option>
                                        {foreach $cangku as $k => $v}
                                        <option value="{$k}" {if !empty(input('get.cangku')) &&
                                            input('get.cangku')==$k}selected{/if}>{$v|default=''}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">类型</label>
                                <div class="layui-input-inline">
                                    <select name="types">
                                        <option value="">类型</option>
                                        {foreach $types as $k => $v}
                                        <option value="{$k}" {if !empty(input('get.types')) &&
                                            input('get.types')==$k}selected{/if}>{$v|default=''}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">物流状态</label>
                                <div class="layui-input-inline">
                                    <select name="status">
                                        <option value=""></option>
                                        {foreach $statuss as $k => $v}
                                        <option value="{$k}" {if !empty(input('get.status')) &&
                                            input('get.status')==$k}selected{/if}>{$v}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">付款状态</label>
                                <div class="layui-input-inline">
                                    <select name="paystatus">
                                        <option value=""></option>
                                        {foreach $paystatuss as $k => $v}
                                        <option value="{$k}" {if !empty(input('get.paystatus')) &&
                                            input('get.paystatus')==$k}selected{/if}>{$v}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">搜索</button>
                                <a class="layui-btn layui-bg-cyan layui-bt"
                                    onclick="open_add('添加','list_edit')">添加订单</a>
                            </div>
                        </form>
                    </fieldset>

                </div>
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div class="layadmin-backlog">
                            <div class="layui-card-header">数据统计(仅统计筛选结果)</div>
                            <ul class="layui-row layui-col-space10">
                                <div class="layui-col-md1">
                                    <a lay-href="##" class="layadmin-backlog-body">
                                        <h3>累计订单数据</h3>
                                        <p><cite>{$list->total()}</cite>条</p>
                                    </a>
                                </div>
                                <div class="layui-col-md2">
                                    <a lay-href="##" class="layadmin-backlog-body">
                                        <h3>入库件数汇总</h3>
                                        <p><cite>{$bdata.rnumber|default='0'}</cite>件</p>
                                    </a>
                                </div> <div class="layui-col-md2">
                                <a lay-href="##" class="layadmin-backlog-body">
                                    <h3>入库金额汇总</h3>
                                    <p><cite>{$bdata.rtotal|default='0'}</cite>元</p>
                                </a> </div> <div class="layui-col-md2">
                                <a lay-href="##" class="layadmin-backlog-body">
                                    <h3>出库件数汇总</h3>
                                    <p><cite>{$bdata.cnumber|default='0'}</cite>件</p>
                                </a> </div> <div class="layui-col-md2">
                                <a lay-href="##" class="layadmin-backlog-body">
                                    <h3>出库金额汇总</h3>
                                    <p><cite>{$bdata.ctotal|default='0'}</cite>元</p>
                                </a> </div>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="layui-table-body layui-table-main layui-card-body">
                    <table class="layui-table layui-form layui-card-header">
                        <thead>
                            <tr>
                                <th>
                                    <div class="layui-table-cell">操作</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">订单ID</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">组别</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">类型</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">日期</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">出入库信息</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">订单及付款状态</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">备注</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">经办人</div>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $list as $v}
                            <tr>
                                <td class="td-manage">
                                    <div class="layui-table-cell">
                                        <a title="编辑" onclick="open_add('编辑','/shose/list_edit?id={$v.id}')"
                                            href="javascript:;" class="layui-btn layui-btn-sm">
                                            编辑
                                        </a>
                                    </div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.id|default=''}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.cangku|default=''}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.type|default=''}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.times|default='0000-00-00'}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">出库件数:{$v.cnumber|default='0'}件</div>
                                    <div class="layui-table-cell">出库金额:{$v.ctotal|default='0'}元</div>
                                    <div class="layui-table-cell">入库件数:{$v.rnumber|default='0'}件</div>
                                    <div class="layui-table-cell">入库金额:{$v.rtotal|default='0'}元</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">订单状态:{$v.status|default=''}</div>
                                    <div class="layui-table-cell">付款状态:{$v.paystatus|default=''}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.remark|default='无'}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.jsr|default='无'}</div>
                                </td>
                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        {$list->render()|raw}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</body>
{include file="public/footer"}
<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#starttime' //指定元素
            , type: 'date'

        });
    });
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#endtime' //指定元素
            , type: 'date'

        });
    });
</script>
<script>
    layui.use('upload', function () {
        var $ = layui.jquery
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            , accept: 'file'
            , url: '/shop/import_batch_send' //上传接口
            , before: function (obj) { //obj参数包含的信息，跟 choose回调完全一致，可参见上文。
                layer.load(); //上传loading
            }, done: function (res) {
                layer.closeAll('loading'); //关闭loading
                //如果上传失败
                if (res.status == 0) {
                    str = '导入完成，失败个数' + res.data.length + '<br/>';
                    $.each(res.data, function (i, obj) {
                        str += '<div>第' + obj.key + '行:' + obj.msg + '</div>';
                    });
                    layer.open({
                        type: 0,
                        content: str,
                        yes: function () {
                            location.reload();
                        }
                    });
                    return false;
                } else {
                    layer.msg(res.msg, { icon: 2, time: 1000 });
                    return false;
                }
            }
            , error: function () {
                layer.closeAll('loading'); //关闭loading
                layer.msg('请求失败请重试', { icon: 2, time: 1000 });
                return false;

            }
        });
    });
</script>
<script>
    function money_edit(title, url, id) {
        layer.prompt({
            formType: 0,
            value: 0,
            title: title,
        }, function (value, index, elem) {
            $.ajax({
                type: 'post',
                url: url,
                data: { id: id, money: value },
                success: function (res) {
                    if (res.code == 0) {
                        layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                            layer.close(index);
                            // 获得frame索引
                            location.reload();
                        });
                    } else {
                        layer.msg(res.msg, { icon: 2, time: 1000 });
                    }
                }
            });
            return false;

        });
    }
    layui.use(['form', 'upload'], function () {
        var $ = layui.jquery
            , form = layui.form
            , layer = layui.layer;
    });
</script>
<script>
    layer.photos({
        photos: '#layer-photos'
        , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
    });
</script>